<template>
  <div class="recommend-view" @click="goToProduct(recommendList.action.path)">
    <img :src="recommendList.image_url" alt="">
    <div class="recommend-con">
        <div class="recommend-name">{{ recommendList.name }}</div>
        <div class="recommend-price">
            ￥{{ recommendList.price }}
            <span>￥{{ recommendList.market_price }}</span>
        </div>
    </div>
  </div>
</template>

<script>
export default {
    props: ['recommendList'],
    methods: {
        goToProduct(id){
            this.$router.push({
                path:`/productdetails/${id}`
            })
        } 
    }
}
</script>

<style lang="scss" scoped>
.recommend-view{
    width: 50vw;

    img{
        width: 50vw;
        height: auto;
    }

    .recommend-con{
        width: 50vw;
        padding: 2vw;
        box-sizing: border-box;
        
        .recommend-name{
            color: #3c3c3c;
            font-size: 15px;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
        }

        .recommend-price{
            color: #ff6700;
            font-size: 17px;

            span{
                color: #999;
                font-size: 14px;
                text-decoration: line-through;
            }
        }
    }
}
</style>